#ifndef __WINCONFIGDEFS_H__
#define __WINCONFIGDEFS_H__

#ifdef __cplusplus
extern "C" {
#endif
//int read(int, void *, int);
//int write(int, const void *, int);
int ioctl(int, int, ...);
int close(int);
//int lseek(int, int, int);
int fcntl(int, int, ...);
int open(const char *, int, ...);
//int rint(double a);
int finite(double a);
void sleep(int);
#ifdef __cplusplus
}
#endif

#include <winerror.h>

// Not defined
#define fsync(a)
#if defined(__VISUAL_STUDIO)
#define X_OK 4
#define 	PATH_MAX   1024
#define mode_t int
typedef long _ssize_t;
typedef _ssize_t ssize_t;
#define pid_t int
#endif
#define getpagesize() 8192
#define uid_t int
#define LOG_PID 1
#define LOG_LOCAL1 1


#define 	EWOULDBLOCK   140 // WSAEWOULDBLOCK
#define 	MAXPATHLEN   PATH_MAX
#define	    LOG_NOTICE	5
#define 	LOG_INFO   6
#define     MS_SYNC 4
#define     MS_ASYNC 1
#define		MS_INVALIDATE 0
# define W_OK 2
# define R_OK 4
# define S_ISVTX 0

typedef char* caddr_t;
typedef unsigned int u_int;
typedef int clock_t;
struct tms {
      	clock_t	tms_utime;	/* [XSI] User CPU time */
      	clock_t	tms_stime;	/* [XSI] System CPU time */
      	clock_t	tms_cutime;	/* [XSI] Terminated children user CPU time */
      	clock_t	tms_cstime;	/* [XSI] Terminated children System CPU time */
};

struct timezone {
    int tz_minuteswest, tz_dsttime;
};

struct	sigvec {
	void	(*sv_handler)();	/* signal handler */
	int	sv_mask;		/* signal mask to apply */
	int	sv_flags;		/* see signal options below */
};

struct	sigaction {
	void	(*sa_handler)();	/* signal handler */
	int	sa_mask;		/* signal mask to apply */
	int	sa_flags;		/* see signal options below */
};

#  define	RLIMIT_CORE	4
#  define	RLIM_INFINITY	0x7fffffff
typedef	unsigned int	rlim_t;
struct rlimit {
	rlim_t	rlim_cur;		/* current limit */
 	rlim_t	rlim_max;		/* maximum value for rlim_cur */
};

typedef int pthread_mutex_t;
#define PTHREAD_MUTEX_INITIALIZER 0;
#define	_SC_CLK_TCK	3

#define SIGALRM SIGTERM
#define SIGPIPE SIGTERM
#define	SIGBUS	10

/* Following are the values taken by the "mmap_flags" parameter of MemMapFile() */
#define MAP_SHARED      1               /* share changes */
#define MAP_PRIVATE     2               /* changes are private */
#define MAP_TYPE        0xf             /* mask for share type */
/* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */
#define MAP_FIXED       0x10            /* user assigns address */
#define MAP_NORESERVE   0x40            /* don't reserve needed swap area */
#define MAP_FAILED      ((void *) -1)

#define PROT_READ       0x1             /* pages can be read */
#define PROT_WRITE      0x2             /* pages can be written */

#define	F_GETFD		1		/* get file descriptor flags */
#define	F_SETFD		2		/* set file descriptor flags */

#include <winsock2.h>

struct passwd {
	char* pw_passwd;
	char* pw_name;
};

#endif // __WINCONFIGDEFS_H__
